<!doctype html>
<html>
<head>
    <title>主页</title>
    <meta charset="utf-8"/>
    <script type="text/javascript" src="jquery-1.8.2.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $('.ca').click(function(){
                var that = this;
                $('#tab tr[align=center]').remove();
                var page = $(this).attr('i');
                $.ajax({
                    url:"pageshow.class.php?data="+Math.random(),
                    data:'q='+page,
                    type:'POST',
                    async:true,
                    success:function(data){
                        var json = JSON.parse(data);
                        for(i in json){
                            var tr = $("<tr align='center'>");
                            var tid = $("<td>").html(json[i]['id']);
                            var tname = $("<td>").html(json[i]['name']);
                            var tprice = $("<td>").html(json[i]['paid']);
                            tr.append(tid).append(tname).append(tprice);
                            $("#tab").append(tr);

                        }
                    }
                });
            });
        });

    </script>
</head>
<body>
<center>
    <h1>手机信息管理系统</h1>
    <hr/>
    <?php
        require_once("model.class.php");
        $p = new demo();
        $p->showlist(@$_GET['page']);
    ?>
    <table id="tab" width="450" border="1">
        <thead>
            <tr><th>手机ID</th><th>手机名</th><th>手机价格</th></tr>
        </thead>
            <?php
                foreach($p->row as $v){
            ?>
                <tr align="center"><td><?php echo $v['id'];?></td><td><?php  echo $v['name'];?></td><td><?php  echo $v['paid'];?></td></tr>
            <?php
                }
            ?>
    </table>
    <br/>
    <?php
        require_once("page.class.php");
        $q = new page(@$_GET['page'],$p->count,2);
        $q->showpage();
    ?>
</center>
</body>
</html>